/**
 * 翻译词典
 */
package com.axt.dbaudit.bean.cfg;

import java.util.List;

import com.axt.dbaudit.base.MsgFuncExt;
import com.axt.dbaudit.model.cfg.TransDict;
import com.axt.soa.bean.BaseFuncBean;
import com.axt.soa.msg.types.MsgParam;

public class TransDictBean extends BaseFuncBean {
	/**
	 * 添加翻译词典信息
	 * 
	 * @param aServerPath
	 *            节点的路径： 管理平台为 -10 其他用GetServerId来获取
	 * @param aTransDict
	 *            字典信息
	 * @return
	 */
	public int add(String serverPath, TransDict transDict) {
		prepare(serverPath);

		request.addParam(MsgParam.MSG_COL_AU_ENGLISH, transDict.getAu_eng());
		request.addParam(MsgParam.MSG_COL_AU_CHINESE, transDict.getAu_chi());
		return execute(MsgFuncExt.FUNC_ADD_TRANS_DICT, CONN_T_TCP);
	}

	/**
	 * 删除
	 * 
	 * @param aServerPath
	 * @param aEnglish
	 * @return
	 */
	public int delete(String serverPath, String english) {
		prepare(serverPath);

		request.addParam(MsgParam.MSG_COL_AU_ENGLISH, english);
		return execute(MsgFuncExt.FUNC_DELETE_TRANS_DICT, CONN_T_TCP);
	}

	/**
	 * 获取翻译字典列表
	 * 
	 * @param aServerPath
	 * @return
	 */
	public List<TransDict> query(String serverPath) {
		prepare(serverPath);

		return fetch(MsgFuncExt.FUNC_QUERY_TRANS_DICT,
				"com.axt.dbaudit.model.TransDict", "TransDict", CONN_T_TCP);
	}

	/**
	 * 修改字典信息
	 * 
	 * @param aServerPath
	 * @param aTransDict
	 * @return
	 */
	public int modify(String serverPath, TransDict transDict) {
		prepare(serverPath);

		request.addParam(MsgParam.MSG_COL_AU_ENGLISH, transDict.getAu_eng());
		request.addParam(MsgParam.MSG_COL_AU_CHINESE, transDict.getAu_chi());
		return execute(MsgFuncExt.FUNC_UPDATE_TRANS_DICT, CONN_T_TCP);
	}
}
